
module.exports = {
  mode: 'universal',
  /*
  ** Headers of the page
  */
  head: {
    title: process.env.npm_package_name || '',
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: process.env.npm_package_description || '' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ],
    script: [
      { src: 'http://api.map.baidu.com/api?v=2.0&ak=kmxI7Hj2rGxxScm8OG4qS7sYIWzKo8QN' }
    ]
  },
  /*
  ** Customize the progress-bar color
  */
  loading: { color: '#fff' },
  /*
  ** Global CSS
  */
  css: [
    'swiper/dist/css/swiper.css',
    { src: '@/assets/style.scss', lang: 'scss' }
    // 'element-ui/lib/theme-chalk/index.css'
  ],
  axios: {
    proxy: true,
    prefix: '/api', // baseURL
    credentials: true
  },
  proxy: {
    '/api': {
      target: 'http://localhost:8888', // 代理地址
      changeOrigin: true,
      pathRewrite: {
        '^/api': ''
      }
    },
  },
  /*
  ** Plugins to load before mounting the App
  */
  plugins: [
    '@/plugins/element-ui',
    { src: "@/plugins/vue-awesome-swiper", ssr: false }
  ],
  router: {
    // linkActiveClass: 'active',
    linkExactActiveClass: 'active'
  },
  /*
  ** Nuxt.js dev-modules
  */
  buildModules: [
    // Doc: https://github.com/nuxt-community/eslint-module
    '@nuxtjs/eslint-module',
    // ['@nuxtjs/dotenv', { filename: '.env.prod' }] // 如果是生产环境使用 .env.prod配置文件
    ['@nuxtjs/dotenv', { /* module options */ }]
  ],
  /*
  ** Nuxt.js modules
  */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    '@nuxtjs/proxy'
  ],
  /*
  ** Build configuration
  */
  build: {
    babel: {
      plugins: [
        ['component', {
          'libraryName': 'element-ui',
          'styleLibraryName': 'theme-chalk'
        }]
      ]
    },
    // transpile: [/^element-ui/],
    /*
    ** You can extend webpack config here
    */
    extend (config, ctx) {
    }
  }
}
